# Update Email Metadata Job
Repairs the content type and extracted metadata (sender, recipients, subject, etc.) of .msg/.eml files already stored in SharePoint.
Configuration class: UpdateEmailMetadataJobCfg (SharepointCfg.UpdateEmailMetadataJob)
Schedule base: EveryNightScheduleCfg, but runs once daily at a single fixed time rather than a random time within the night window.
This job is separate from Update Document Metadata, which applies general configurable metadata rules — this job specifically targets email files and re-parses them to (re)populate email-specific metadata and content type.
# Purpose
Emails imported outside the normal migration/provisioning flow (or affected by a parsing issue at import time) can end up with the wrong content type or missing sender/recipient metadata. This job finds such files via search and repairs them.
# Configuration
# Enabled
- Type:
bool - Default:
false - Description: The job does not run at all unless this is enabled.
# StartTime
- Type:
TimeSpan? - Default:
21:00:00 - Description: Time of day the job runs. The job does not run at all if this is not set.
# EndTime
- Type:
TimeSpan? - Default:
06:00:00 - Description: Time of day after which the job stops processing further pages of search results, even if unfinished — the run resumes where it left off on subsequent scheduled runs since matching files are found again by search.
# SearchForWrongContentType
- Type:
bool - Default:
true - Description: When enabled, includes
.msg/.emlfiles whose content type is not the configured email content type in the search criteria.
# SearchForNoEmailMetaData
- Type:
bool - Default:
true - Description: When enabled, includes
.msg/.emlfiles with noDMSSendervalue in the search criteria.
# AdditionalSearchCriteria
- Type:
string - Default: —
- Description: Extra SharePoint search query text, ANDed onto the base query. Example:
"DMSMatterCode:10332"to limit the job to a single matter while testing.
# ForceMetaDataUpdate
- Type:
bool - Default:
false - Description: When enabled, metadata is re-extracted and the content type is reset for every matching file on every run, even if the
SMTPFromcolumn already has a value. When disabled (default), metadata is only re-extracted whenSMTPFromis empty or was previously markedInvalid.
# How It Works
- Runs a SharePoint search for
.msg/.emlfiles, combined with the DMS Configuration's global search filter andAdditionalSearchCriteria, further restricted bySearchForNoEmailMetaDataand/orSearchForWrongContentType(either condition qualifies a file for reprocessing), sorted by matter code. - Pages through results (500 per page), stopping early once
EndTimeis reached. - For each matching file, ensures the email content type is present on its document library, then sets the file's content type to the configured email content type.
- Re-extracts metadata (sender, recipients, subject, etc. from the
.msg/.emlcontent) whenForceMetaDataUpdateistrue, or when the file'sSMTPFromcolumn is empty or equalsInvalid. - If the file cannot be parsed (corrupt or unsupported format),
SMTPFromis set toInvalidinstead of being left empty. This lets a permanently unparseable file be distinguished from one that simply hasn't been processed yet, since a fresh parse attempt is not re-triggered just because a value happens to be present.
Soft limit of ~5 concurrent; beyond that a run waits up to ~1 hour, then proceeds regardless.
# Related
- Update Document Metadata — general configurable metadata rules, not email-specific
- Jobs — other background jobs